import {getForm2} from '@request/api.js'
export const approvalList ={
	data(){
		return{
			fromDataList:[],
			allColor:{},
			downLoad:true,
		}
	},
	mounted() {
		this.getList()
		this.allColor = this.$store.state.allColor
	},
	computed:{
		imgSrc(){
			return function(val){
				if(val == '已完成'){
					return `checked`
				}else if(val == '已驳回'){
					return `clear`
				}else if(val == '审批中'){
					return `clock`
				}else if(val == '已撤消'){
					return `stop-circle`
				}else{
					return `comment-circle`
				}
			}
		},
		textColor(){
			return function(val){
				if(val === '已完成'){
					return {'color':this.allColor.finish_list_icon_color}
				}else if(val === '已驳回'){
					return {'color':this.allColor.exit_list_icon_color}
				}else if(val === '审批中'){
					return {'color':this.allColor.wait_list_icon_color}
				}else if(val === '已撤消'){
					return {'color':this.allColor.cancel_list_icon_color}
				}else{
					return {'color':this.allColor.draft_list_icon_color}
				}			
			}
		},
		storeColor(){
			return this.$store.state.allColor
		}
	},
	watch:{
		storeColor:function(val){
			this.allColor = val
		}
	},
	filters:{
		dept(val){
			let arr = val.split("-")
			const{length,last=length-1} = arr
			const lastItem = arr[last]
			return lastItem
		},
		workStates(val) {
			return val == '审批中' ? '待审批' : '未知状态'
		},
		s_name(val){
			let arr = val.split(',')
			if(arr.length<=1){
				return val
			}else{
				val = `${arr[0]}...`
				return val
			}
		},
	}
}